import { getAll , get ,delivery } from '@/api/order';

const actions = {
    //获取全部订单
    getAll({ commit }, param) {
    //解构传值
     const { pageNum,pageSize } = param;
        return new Promise((resolve, reject) => {
            getAll({ pageNum: pageNum,pageSize:pageSize })
                .then(response => {
                    const { data } = response;
                    resolve(data);
                })
                .catch(error => {
                    reject(error);
                });
        });
    },
	get({ commit }, param) {
	//解构传值
	    return new Promise((resolve, reject) => {
	        get(param)
	            .then(response => {
	                const { data } = response;
	                resolve(data);
	            })
	            .catch(error => {
	                reject(error);
	            });
	    });
	},
	delivery({ commit }, param) {
	//解构传值
	    return new Promise((resolve, reject) => {
	        delivery(param)
	            .then(response => {
	                const { data } = response;
	                resolve(data);
	            })
	            .catch(error => {
	                reject(error);
	            });
	    });
	},
};

export default {
    namespaced: true, //***
    actions
};